<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title></title>
    <script src='./vue.global.js'></script>
</head>

<body>
    <div id='app'>
        <base-layout>

            <!-- template幽灵标签以内的内容均插入名为head的插槽内 -->
            <!-- xx是任意给【插槽暴露出来的数据集】起的一个别名 -->
            <template v-slot:head="xx">
                <h3>哥是{{xx.title}}</h3>
                <span>{{xx.date}}</span>
            </template>

            <!-- template幽灵标签以内的内容均插入名为foot的插槽内 -->
            <template v-slot:foot="spFoot">
                <h3>姐是{{spFoot.link}}</h3>
            </template>

            <template v-slot:default="slotProps">
                <p v-for="line in slotProps.poem">{{line}}</p>
                <p style="padding-left:50px;">作者:{{slotProps.author}}</p>
            </template>

        </base-layout>
    </div>

    <script>
        const app = Vue.createApp({
            data() {
                return {}
            },
            methods: {},
            computed: {}
        })

        app.component("base-layout", {
            data(){
                return {
                    title: "一场暴雨洗净国庆回家之路",
                    link: "点我去黄易",
                    poem: [
                        "大海啊你全特么是水",
                        "蜘蛛啊你全特么是大长腿",
                        "辣椒啊真特么辣嘴",
                        "不好好学Vue真特么后悔",
                    ],
                    author:"法外狂徒张三"
                }
            },
            template: `
            <div>
                <header>
                    <slot name="head" :title="title" :date="new Date().toString()"></slot>
                </header>

                <main>
                    <!-- name="default" -->
                    <slot :poem="poem" :author="author"></slot>
                </main>

                <footer>
                    <slot name="foot" :link="link"></slot>
                </footer>
            </div>
            `
        })

        app.mount('#app')
    </script>
</body>

</html>